import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:study_online/pages/messagePage/home_page.dart';
import 'package:study_online/pages/Tabs.dart';
import 'package:study_online/pages/chatPage/chat_page.dart';
import 'package:study_online/pages/contactsPage/contacts_page.dart';
import 'package:study_online/pages/courseStudyPage/views/CourseStudyPage.dart';
import 'package:study_online/pages/courseStudyPage/views/PublishRemarkPage.dart';
import 'package:study_online/pages/discussPage/views/DiscussPage.dart';
import 'package:study_online/pages/discussPage/views/ProblemDetailPage.dart';
import 'package:study_online/pages/discussPage/views/PublishDiscussPage.dart';
import 'package:study_online/pages/homePage/views/ComputerScienceView.dart';
import 'package:study_online/pages/loginRegisterPage/views/LoginView.dart';
import 'package:study_online/pages/loginRegisterPage/views/RegisterView.dart';
import 'package:study_online/pages/myPage/views/UserInformationPage.dart';
import 'package:study_online/pages/studyPage/views/CourseDetailPage.dart';
import 'package:study_online/pages/testPage/views/TestPage.dart';
import 'package:study_online/pages/testPage/views/TestReportPage.dart';
import 'package:study_online/test.dart';

// Map<String, WidgetBuilder> routes={
//    "/":(context)=>Test1(),
//   "register":(context)=>RegisterPage(),
//   "app":(context)=>Tabs(),
//   'courseStudy': (context) => CourseStudyPage(),
//
// };
Route<dynamic> onGenerateRoute(RouteSettings settings) {
  var routes = <String, WidgetBuilder>{
    //"/":(context)=>Tabs(),
    "/": (context) => LoginPage(),
    "tabs":(context)=>Tabs(),
    "register": (context) => RegisterPage(),
    "app": (context) => Tabs(),
    'chatPage': (context) => ChatPage(
          (settings.arguments as List)[0],
          (settings.arguments as List)[1],
          (settings.arguments as List)[2],
        ),
    'courseDetail': (context) => CourseDetailPage(
          (settings.arguments as List)[0],
          (settings.arguments as List)[1],
          (settings.arguments as List)[2],
          (settings.arguments as List)[3],
        ),
    'discuss': (context) => DiscussPage((settings.arguments as List)[0]),
    'courseStudy': (context) =>
        CourseStudyPage((settings.arguments as List)[0]),
    'problemDetail': (context) => ProblemDetailPage(problem : (settings.arguments as List)[0]),
    'publishDiscuss': (context) =>
        PublishDiscussPage(couId: (settings.arguments as List)[0]),
    'test': (context) => TestPage(
          stuId: (settings.arguments as List)[0],
          paId: (settings.arguments as List)[1],
          title: (settings.arguments as List)[2],
        ),
    'testReport': (context) => TestReportPage(
          trueNum: (settings.arguments as List)[0],
          ansList: (settings.arguments as List)[1],
          title: (settings.arguments as List)[2],
          minute: (settings.arguments as List)[3],
          second: (settings.arguments as List)[4],
        ),
    'publishRemark': (context) => PublishRemarkPage(),
    'computerScience': (context) => ComputerScienceView(),
    'contactsPage': (context) => ContactsPage(),
    'userInformation': (context) => UserInformationPage(),
  };
  WidgetBuilder builder = routes[settings.name];
  return MaterialPageRoute(builder: (ctx) => builder(ctx));
}
